using Microsoft.EntityFrameworkCore;
using Mvc.Sample.Data;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddControllersWithViews();
builder.Services.AddDbContext<ApplicationDbContext>(options =>
    options.UseSqlite("Data Source=database.db"));
builder.Services.AddMiniProfiler(configureOptions: options =>
{
	options.RouteBasePath = "/profiler";
	options.PopupMaxTracesToShow = 5;
}).AddEntityFramework();
var app = builder.Build();
if (!app.Environment.IsDevelopment())
{
    app.UseExceptionHandler("/Home/Error");
    app.UseHsts();
}

app.UseDeveloperExceptionPage();
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseMiniProfiler();
app.MapControllerRoute(
    name: "Todo",
    pattern: "{area:exists}/{controller=Home}/{action=Index}/{id?}"
);

app.MapControllerRoute(
    name: "default",
    pattern: "{controller=Home}/{action=Index}/{id?}"
);
app.Run();
